//
// Created by 谢哲 on 2021/5/18.
//

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

vector<vector<int>> edges;
vector<int> dp_data;

void dfs(int pos, int val) {
    if (dp_data[pos]>=0) return;
    dp_data[pos] = val;
    for (auto edge: edges[pos]) {
        dfs(edge, val);
    }
}

int main() {
    int N, M;
    cin >> N >> M;

    edges.resize(N);
    dp_data.resize(N, -1);

    for (int i=0; i<M; ++i) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        edges[b].emplace_back(a);
    }

    for (int i=N; i>=1; --i) {
        dfs(i-1, i);
    }

    for (auto p: dp_data) cout << p << " ";

    return 0;
}
